package com.jame.design_mode.singleton;

import org.junit.Test;

/**
 * @author : Jame
 * @date : 2021-01-03 15:33
 **/
public class Mytest {
    public static void main(String[] args) {

    }
    /**
     * 测试单例懒汉模式
     */
    @Test
    public void testLazySingleton() {
        new Thread(()->{
            LazySingleton lazySingleton = LazySingleton.getLazySingleton();
            System.out.println(lazySingleton);
        }).start();
        new Thread(()->{
            LazySingleton lazySingleton = LazySingleton.getLazySingleton();
            System.out.println(lazySingleton);

        }).start();
    }
    @Test
    public void testInnerClassSingleton(){
        InnerClassSingleton classSingleton = new InnerClassSingleton();
        System.out.println(InnerClassSingleton.InnerClass.getInnerClass());
        System.out.println(InnerClassSingleton.InnerClass.getInnerClass());
    }  @Test
    public void testHungetSingleton(){

    }
}
